<template>
  <div class="model-bg">
      <div class="model-content">
          <div class="model-title"><span v-html="title"></span><i @click="closeModel" class="model-close el-icon-close"></i></div>
          <div>
              <slot></slot>
          </div>          
      </div>
  </div>
</template>

<script>
export default {
  name:'model-box',
  props:{
      title:{
          type:String,
          default:function(){
              return "操作中心"
          }
      }
  },

  methods:{
      closeModel(){
         this.$emit("closeModel");
      }
  }
}

</script>
<style scoped>
    .model-bg{
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1995;
    }
    .model-content{
        min-width: 300px;
        min-height: 150px;
        background-color: #ffffff;
        border-radius: 5px;
        box-sizing: border-box;
        padding: 10px;
        padding-top: 45px;
        position: relative;
        overflow: hidden;
    }
    .model-title{
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 45px;
        box-sizing: border-box;
        border-bottom: 1px solid #ededed;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .model-close{
        position: absolute;
        top: 0;
        right: 0;
        display: inline-block;
        height: 45px;
        width: 45px;
        font-size: 24px;
        line-height: 45px;
        text-align: center;
        color: #333;
        cursor: pointer;
    }
</style>